#ifndef POPUP_H
#define POPUP_H

#include <QWidget>
#include <QLabel>
#include <QGridLayout>
#include <QPropertyAnimation>
#include <QTimer>
namespace utils {
class PopUp : public QWidget
{
	Q_OBJECT

	Q_PROPERTY(float popupOpacity READ getPopupOpacity WRITE setPopupOpacity)

	void setPopupOpacity(float opacity);
	float getPopupOpacity() const;

public:
	explicit PopUp(QRect currentGeometry, QWidget *parent = 0);

protected:
	void paintEvent(QPaintEvent *event) override;

public slots:
	void setPopupText(const QString& text);
	void show();

private slots:
	void hideAnimation();
	void hide();

private:
	QLabel label;
	QGridLayout layout;
	QPropertyAnimation animation;
	float popupOpacity;
	QTimer *timer;
	QRect currentGeometry;
};
}


#endif //POPUP_H
